// Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
//
// Licensed under the Mulan PSL v2.
// You can use this file according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of the License at
//
//     http://license.coscl.org.cn/MulanPSL2
//
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
// FOR MORE DETAILS.

/*
 * @Author: qiulin_JXGM ql1746365080@gmail.com
 * @Date: 2024-09-19 14:42:40
 * @LastEditors: wxc superjava@qq.com
 * @LastEditTime: 2024-09-29 17:17:43
 * @FilePath: /SGFEM/DBManager/test/HDF5/I_DynamicTest.cpp
 */

#include <gtest/gtest.h>

#include "DataStructure/Common/Status.h"

#include "DBManager/DBServiceFactory.h"
#include "DBManager/IService/Input/Dynamic/IEIGCService.h"
#include "DBManager/IService/Input/Dynamic/IEIGRLService.h"
#include "DBManager/UnitTest/HDF5/TestDB.h"

using namespace SG::DBManager;

using namespace SG::DataStructure::FEM;
using namespace SG::DBManager;

class I_DynamicTest : public testing::Test
{
  public:
    static void SetUpTestSuite ()
    {
        if (DB::ServiceFactory != nullptr)
        {
            DB::ServiceFactory->ClearDatabase ();
        }
    }
};

TEST_F (I_DynamicTest, EIGRLData)
{
    // 创建对象
    EIGRLData obj;
    obj.m_sId     = 99;
    obj.m_ND      = 10;
    obj.m_NORM[0] = 'M';
    obj.m_NORM[1] = 'A';
    obj.m_NORM[2] = 'S';
    obj.m_NORM[3] = 'S';

    // 获取服务
    auto service = DB::ServiceFactory->get<IEIGRLService> ();
    // 添加对象
    service->Add (obj);
    obj.m_sId     = 9;
    obj.m_ND      = 10;
    obj.m_NORM[0] = 'M';
    obj.m_NORM[1] = 'A';
    obj.m_NORM[2] = 'X';
    obj.m_NORM[3] = '\0';
    service->Add (obj);
    ASSERT_EQ (service->Size (), 2);

    EIGRLData data;
    ASSERT_EQ (service->FindBySId (99, data), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (data.m_sId, 99);
    ASSERT_EQ (data.GetMNEType (), EIGRLData::MASS);

    ASSERT_EQ (service->FindBySId (9, data), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (data.m_sId, 9);
    ASSERT_EQ (data.GetMNEType (), EIGRLData::DISP);
}

TEST_F (I_DynamicTest, EIGCData)
{
    // 创建对象
    EIGCData obj;
    obj.m_sId     = 99;
    obj.m_ND1     = 10;
    obj.m_NORM[0] = 'M';
    obj.m_NORM[1] = 'A';
    obj.m_NORM[2] = 'S';
    obj.m_NORM[3] = 'S';

    // 获取服务
    auto service = DB::ServiceFactory->get<IEIGCService> ();
    // 添加对象
    service->Add (obj);
    obj.m_sId     = 9;
    obj.m_ND1     = 10;
    obj.m_NORM[0] = 'M';
    obj.m_NORM[1] = 'A';
    obj.m_NORM[2] = 'X';
    obj.m_NORM[3] = '\0';
    service->Add (obj);
    ASSERT_EQ (service->Size (), 2);

    EIGCData data;
    ASSERT_EQ (service->FindBySId (99, data), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (data.m_sId, 99);

    ASSERT_EQ (service->FindBySId (9, data), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (data.m_sId, 9);
}

#include "DBManager/IService/Input/Dynamic/IEIGRService.h"
TEST_F (I_DynamicTest, EIGRDatatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IEIGRService> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    EIGRData obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<EIGRData> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFBADLAYService.h"
TEST_F (I_DynamicTest, FBADLAYDatatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFBADLAYService> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FBADLAYData obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FBADLAYData> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFBALOADService.h"
TEST_F (I_DynamicTest, FBALOADDatatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFBALOADService> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FBALOADData obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FBALOADData> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFBAPHASService.h"
TEST_F (I_DynamicTest, FBAPHASDatatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFBAPHASService> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FBAPHASData obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FBAPHASData> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFREQ1Service.h"
TEST_F (I_DynamicTest, FREQ1Datatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFREQ1Service> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FREQ1Data obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FREQ1Data> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFREQ2Service.h"
TEST_F (I_DynamicTest, FREQ2Datatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFREQ2Service> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FREQ2Data obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FREQ2Data> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFREQ3Service.h"
TEST_F (I_DynamicTest, FREQ3Datatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFREQ3Service> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FREQ3Data obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FREQ3Data> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFREQ4Service.h"
TEST_F (I_DynamicTest, FREQ4Datatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFREQ4Service> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FREQ4Data obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FREQ4Data> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFRFCOMPService.h"
TEST_F (I_DynamicTest, FRFCOMPTest)
{
    DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IFRFCOMPService> ();

    SG::DataStructure::FEM::FRFCOMPData data;
    data.m_id = 1;
    service->Add (data);

    SG::DataStructure::FEM::FRFCOMPData _OUT outData;
    service->FindById (1, outData);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Dynamic/IFRFCONNService.h"
TEST_F (I_DynamicTest, FRFCONNDatatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFRFCONNService> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FRFCONNData obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FRFCONNData> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFRFFLEXService.h"
TEST_F (I_DynamicTest, FRFFLEXDatatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFRFFLEXService> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FRFFLEXData obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FRFFLEXData> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFRFRELSService.h"
TEST_F (I_DynamicTest, FRFRELSDatatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFRFRELSService> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FRFRELSData obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FRFRELSData> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFRFSPC1Service.h"
TEST_F (I_DynamicTest, FRFSPC1Datatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFRFSPC1Service> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FRFSPC1Data obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FRFSPC1Data> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFRFXITService.h"
TEST_F (I_DynamicTest, FRFXITTest)
{
    DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IFRFXITService> ();

    SG::DataStructure::FEM::FRFXITData data;
    data.m_id = 1;
    service->Add (data);

    SG::DataStructure::FEM::FRFXITData _OUT outData;
    service->FindById (1, outData);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Dynamic/ITICService.h"
TEST_F (I_DynamicTest, TICDatatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<ITICService> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    TICData obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<TICData> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFREQService.h"
TEST_F (I_DynamicTest, FREQDatatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFREQService> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FREQData obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FREQData> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IFREQ5Service.h"
TEST_F (I_DynamicTest, FREQ5Datatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IFREQ5Service> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    FREQ5Data obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<FREQ5Data> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/ISPECSELService.h"
TEST_F (I_DynamicTest, SPECSELTest)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<ISPECSELService> ();

    SG::DataStructure::Common::Id id = 0;

    SG::DataStructure::FEM::SPECSELData data;
    data.m_id = id;

    data.m_TABLESList = { { 1, 0.1 }, { 2, 0.2 }, { 3, 0.3 } };
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::SPECSELData _OUT outData;
    ASSERT_EQ (service->FindById (id, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, id);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, id);

    ASSERT_EQ (outData.m_TABLESList.size (), 3);
    ASSERT_EQ (outData.m_TABLESList[0].m_TID, 1);
    ASSERT_EQ (outData.m_TABLESList[0].m_DAMP, 0.1);
    ASSERT_EQ (outData.m_TABLESList[1].m_TID, 2);
    ASSERT_EQ (outData.m_TABLESList[1].m_DAMP, 0.2);
    ASSERT_EQ (outData.m_TABLESList[2].m_TID, 3);
    ASSERT_EQ (outData.m_TABLESList[2].m_DAMP, 0.3);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (id), 1);
}

#include "DBManager/IService/Input/Dynamic/ISPSELService.h"
TEST_F (I_DynamicTest, SPSELTest)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<ISPSELService> ();

    SG::DataStructure::Common::Id id = 0;

    SG::DataStructure::FEM::SPSELData data;
    data.m_id = id;

    data.m_Gi = { 1, 5, 3, 6, 8, 7, 9, 10 };
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::SPSELData _OUT outData;
    ASSERT_EQ (service->FindById (id, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, id);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, id);

    ASSERT_EQ (outData.m_Gi.size (), 8);
    ASSERT_EQ (outData.m_Gi[0], 1);
    ASSERT_EQ (outData.m_Gi[1], 5);
    ASSERT_EQ (outData.m_Gi[2], 3);
    ASSERT_EQ (outData.m_Gi[3], 6);
    ASSERT_EQ (outData.m_Gi[4], 8);
    ASSERT_EQ (outData.m_Gi[5], 7);
    ASSERT_EQ (outData.m_Gi[6], 9);
    ASSERT_EQ (outData.m_Gi[7], 10);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (id), 1);
}

#include "DBManager/IService/Input/Dynamic/IRANDPSService.h"
TEST_F (I_DynamicTest, RANDPSDatatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IRANDPSService> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    RANDPSData obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<RANDPSData> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Dynamic/IRCROSSService.h"
TEST_F (I_DynamicTest, RCROSSDatatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IRCROSSService> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    RCROSSData obj;
    obj.m_sId = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_sId = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<RCROSSData> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}
